#! /usr/bin/env python
###############################################################################
#
# file: greator.py
# author: Victor Bos
# 
# Copyright 2007--2011 Victor Bos
#
# This file is part of GREATOR.
#
#    GREATOR is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    GREATOR is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with GREATOR.  If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
#
# Greator is a platform to develop and play board games like Axis and 
# Allies on the computer.
#
######################################################################

# GREATOR imports
import guiutils
import io
import md

# Standard library imports
import os
import sys
import traceback

# Tkinter imports
import Tkinter

######################################################################
# main
######################################################################
greator_name = "GREATOR"
greator_version = "1.57-Berlin"
def main():
    try:
        tkroot = Tkinter.Tk()
        root = md.Root(tkroot, title="%s %s" % (greator_name, greator_version))
        
        if len(sys.argv)>1:
            root.load_game(sys.argv[1])

        root.mainloop()
            
    except SystemExit, v:
        if v.code != 0:
            traceback.print_exc(v)
    except:
        guiutils.display_error_message("%s -%s- could not be started" % 
                                 (greator_name, greator_version))
        sys.stderr.write("ERROR:\n")
        traceback.print_exc(file=sys.stderr)
        sys.exit(1)
        

if __name__=="__main__":
    main()
